// 帮助函数
let __help = {};
// 递归生成目录树
__help.recursionGenerateShopCategoryTree = function recursionGenerateShopCategoryTree(data) {
    // 目录树
    let tree = [];
    let hash = {};
    data.forEach(item => {
        hash[item.id] = item;
    });
    data.forEach(item => {
        let parent = hash[item.pid];
        if (parent) {
            parent.children.push(item);
        } else {
            tree.push(item);
        }
    });
    return tree;
};

// 数字字符串数字化
__help.string2Number = function(data) {
    let newData = {};
    for (let prop in data) {
        if (data.hasOwnProperty(prop)) {
            let value = data[prop];
            if (_.isNumber(value)) {
                newData[prop] = _.toNumber(value);
            } else {
                newData[prop] = value;
            }
        }
    }
    return newData;
};
